/* 
 * File:   Context.cpp
 * Author: Aaron
 * 
 * Created on 25. Februar 2011, 18:40
 */


// -- Includes
#include "Context.hpp"
#include <CL/cl.hpp>


namespace OpenCLWrapping
{
    Context::Context(const cl::Context& _impl) :
        m_Impl(new cl::Context(_impl))
    {
    }

    Context::Context(const Context& _orig) :
        m_Impl(new cl::Context(*_orig.getImpl()))
    {
    }

    Context::~Context()
    {
        delete m_Impl;
    }

    Context& Context::operator =(const Context& _other)
    {
        // -- Verify that's not a self assignment
        if (this->getImpl() != _other.getImpl())
        {
            delete m_Impl;
            m_Impl = new cl::Context(*_other.getImpl());
        }

        return *this;
    }

    cl::Context* Context::getImpl()
    {
        return m_Impl;
    }

    const cl::Context* Context::getImpl() const
    {
        return m_Impl;
    }
}